package model.market;

public class BetaERPFinanceCharge implements FinanceCharge {

	public double getPeriodFinanceCharge(Position pos,
			MarketInformation marketInfo, MarketManager manager,
			double currentRiskFree, double indexDivYield,
			double indexCapitalReturn) {
		
		if(manager.getPeriod()==0)return 0;
		
		double requiredReturn= pos.getBeta(marketInfo.getMarketPrices(), marketInfo.getAssetBetas())*
						marketInfo.getEquityRiskPremium()/manager.getConfig().getPeriodsInYear()
					+currentRiskFree/manager.getConfig().getPeriodsInYear();
		
		return -pos.getWorth(marketInfo.getMarketPrices())*requiredReturn;
	}

}
